 
begin tran

declare @event_no nvarchar(30)
select @event_no = '20181017F'

select 'KSFKY9JK2017RF' style_no into #tmp_style
union all 
select  'KSFKY9JK2042LO'
union all 
select  'KSFKY9JK2021RF'
union all 
select  'KSFKY9JK2022SL'
union all 
select  'KSFKY9JK2044RF'
union all 
select  'KSFKY9LG6030SL'
union all 
select  'KSFKY9PP6028LO'
union all 
select  'KSFKY9PP6029SL'
union all 
select  'KSFKY9SK8001RF'
union all 
select  'KSFKY9SK8002RF'
union all 
select  'KSFKY9SK8006LO'
union all 
select  'KSFKY9SK8017RF'
union all 
select  'KSFKY9TS0060SL'
union all 
select  'KSFKY9TS0061SL'
union all 
select  'KSFKY9TS0067LO'
union all 
select  'KSFKY9TS0071LO'
union all 
select  'KSFKY9TS0084SL'
union all 
select  'KSFKY9TS0086LO'
union all 
select  'KSFKY9TS0087LO'
union all 
select  'KSFKY9TS0098RF'
union all 
select  'KSFKY9TS0101SL'
union all 
select  'KSFSW9TS0063SL'
union all 
select  'KSFSW9TS0070SL'


insert into fn_event_sku_cancel
select distinct @event_no, sku.sku ,'igsadmin', getdate()
from dc_order_dtl dtl,dc_order_sku sku,dc_order_hdr hdr 
where dtl.order_no=sku.order_no  and 
dtl.order_no=hdr.order_no and 
dtl.style_seq = sku.style_seq and 
dtl.style_no in (select style_no from #tmp_style) and 
hdr.event_no=@event_no and sku.sku 
not in(select sku from fn_event_sku_cancel where event_no=@event_no)   

select * from fn_event_sku_cancel where event_no=@event_no

commit tran

 